package io.renren.modules.jxgk.controller;


import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.common.utils.R;
import io.renren.modules.jxgk.entity.CollegeInfoEntity;
import io.renren.modules.jxgk.service.CollegeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("college/")
public class CollegeInfoController {

    @Autowired
    CollegeInfoService collegeInfoService;

    @RequestMapping("Select")
    public R list(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);
        List<CollegeInfoEntity> cse = collegeInfoService.queryList(query);
        int total = collegeInfoService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(cse, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }
    @RequestMapping("getClassByCollege")
    public R getClassByCollege(@RequestParam Map<String, Object> params){
        //查询列表数据
        List<String> list = collegeInfoService.getClassByCollege(params);
        return R.ok().put("list", list);
    }
    @RequestMapping("getProfessionByCollege")
    public R getProfessionByCollege(@RequestParam Map<String, Object> params){
        //查询列表数据
        List<String> list = collegeInfoService.getProfessionByCollege(params);
        return R.ok().put("list", list);
    }
  //  @RequestMapping("getClassByCollege")
    public R getStudentByClass(@RequestParam Map<String, Object> params){
        //查询列表数据
        List<String> list = collegeInfoService.getClassByCollege(params);
        return R.ok().put("list", list);
    }


    @RequestMapping("getAllcollege")
    public R getAllcollege(){
        //查询列表数据
        List<CollegeInfoEntity> cse = collegeInfoService.getAllcollege();

        return R.ok().put("list", cse);
    }
    @RequestMapping("getAllStudentCollege")
    public R getAllStudentCollege(){
        //查询列表数据
        List<CollegeInfoEntity> cse = collegeInfoService.getAllStudentCollege();

        return R.ok().put("list", cse);
    }

    @RequestMapping("getAllStudentCollege2")
    public R getAllStudentCollege2(){
        //查询列表数据
        List<CollegeInfoEntity> cse = collegeInfoService.getAllStudentCollege2();

        return R.ok().put("list", cse);
    }

    @RequestMapping("/Info/{index}")
    public R info(@PathVariable("index") String index){
        CollegeInfoEntity cie = collegeInfoService.queryObject(index);
        return R.ok().put("college", cie);
    }
}